/**
 * struct cpuhp_cpu_state - Per cpu hotplug state storage
 * @state:	The current cpu state
 * @target:	The target state
 * @fail:	Current CPU hotplug callback state
 * @thread:	Pointer to the hotplug thread
 * @should_run:	Thread should execute
 * @rollback:	Perform a rollback
 * @single:	Single callback invocation
 * @bringup:	Single callback bringup or teardown selector
 * @cpu:	CPU number
 * @node:	Remote CPU node; for multi-instance, do a
 *		single entry callback for install/remove
 * @last:	For multi-instance rollback, remember how far we got
 * @cb_state:	The state for a single callback (install/uninstall)
 * @result:	Result of the operation
 * @done_up:	Signal completion to the issuer of the task for cpu-up
 * @done_down:	Signal completion to the issuer of the task for cpu-down
 */
struct cpuhp_cpu_state {//用于存储每个cpu热插拔状态
	enum cpuhp_state	state;//当前cpu状态
	enum cpuhp_state	target;//目标状态
	enum cpuhp_state	fail;//当前CPU热插拔回调状态
#ifdef CONFIG_SMP
	struct task_struct	*thread;//指向热插拔线程的指针
	bool			should_run;//线程应该执行
	bool			rollback;//执行回滚
	bool			single;//单个回调调用
	bool			bringup;//单个回调bringup或teardown选择器
	struct hlist_node	*node;//远程CPU节点；为安装/删除多实例执行单个入口回调
	struct hlist_node	*last;//记录多实例回滚的位置
	enum cpuhp_state	cb_state;//单个回调（安装/卸载）的状态
	int			result;//操作结果
	struct completion	done_up;//向cpu up任务的发布者发出信号完成
	struct completion	done_down;//向cpu关闭的任务的发布者发出信号完成
#endif
};

/**
 * struct cpuhp_step - Hotplug state machine step
 * @name:	Name of the step
 * @startup:	Startup function of the step
 * @teardown:	Teardown function of the step
 * @cant_stop:	Bringup/teardown can't be stopped at this step
 * @multi_instance:	State has multiple instances which get added afterwards
 */
struct cpuhp_step {//热插拔状态机步骤
	const char		*name;//步骤名称
	union {
		int		(*single)(unsigned int cpu);
		int		(*multi)(unsigned int cpu,
					 struct hlist_node *node);
	} startup;//步骤的启动函数
	union {
		int		(*single)(unsigned int cpu);
		int		(*multi)(unsigned int cpu,
					 struct hlist_node *node);
	} teardown;//步骤的销毁函数
	/* private: */
	struct hlist_head	list;
	/* public: */
	bool			cant_stop;//在启动/销毁这步是否能停止
	bool			multi_instance;//State有多个实例，这些实例随后会被添加
};

enum cpu_mitigations { //这些用于全局“缓解=”cmdline选项，用于切换可选的CPU缓解。
	CPU_MITIGATIONS_OFF, // 关闭
	CPU_MITIGATIONS_AUTO, // 自动
	CPU_MITIGATIONS_AUTO_NOSMT, //自动,无同步多线程
};